aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/groups/[groupId]/expenses/create
diff options
context:
space:
mode:
authorSebastien Castiel <sebastien@castiel.me>2024-01-29 22:37:13 -0500
committerSebastien Castiel <sebastien@castiel.me>2024-01-30 12:57:21 -0500
commit9e300e0ff0c9d93cbaeaa86c1e2a560523107382 (patch)
treeebeaea60117fbac781a415e3299395f3f8e637d7 /src/app/groups/[groupId]/expenses/create
parent3847a67a192a04098643e19953549a99ca152b8a (diff)
Use React’s cache to avoid some queries to the database
Diffstat (limited to 'src/app/groups/[groupId]/expenses/create')
-rw-r--r--src/app/groups/[groupId]/expenses/create/page.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/app/groups/[groupId]/expenses/create/page.tsx b/src/app/groups/[groupId]/expenses/create/page.tsx
index 29a060f..2d580d3 100644
--- a/src/app/groups/[groupId]/expenses/create/page.tsx
+++ b/src/app/groups/[groupId]/expenses/create/page.tsx
@@ -1,5 +1,6 @@
+import { cached } from '@/app/cached-functions'
import { ExpenseForm } from '@/components/expense-form'
-import { createExpense, getCategories, getGroup } from '@/lib/api'
+import { createExpense, getCategories } from '@/lib/api'
import { expenseFormSchema } from '@/lib/schemas'
import { Metadata } from 'next'
import { notFound, redirect } from 'next/navigation'
@@ -15,7 +16,7 @@ export default async function ExpensePage({
params: { groupId: string }
}) {
const categories = await getCategories()
- const group = await getGroup(groupId)
+ const group = await cached.getGroup(groupId)
if (!group) notFound()
async function createExpenseAction(values: unknown) {